#include<iostream>
#include<algorithm>
#include<cstring>
#include<stdio.h>
using namespace std;

const int N = 1000010;

int n,m;
int q[N];

int binary_search(int q[],int len,int x)
{
	int l = 0,r = len+1;
	while(l+1<r)
	{
		int mid = (l+r)>>1;
		if(q[mid]<x){
			l = mid;
		}
		else{
			r = mid;
		}
		
	}
	if(q[r]==x){
		return r;
		}
	else
		return -1;
}
int main()
{
	scanf("%d %d",&n,&m);
	for(int i=1;i<=n;i++){
		scanf("%d",&q[i]);
	}
	while(m--){
		int x;
		scanf("%d",&x);
		int res = binary_search(q,n,x);
		printf("%d ",res);
	}
	return 0;
}
